using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using ClimbTracker.BusinessLogic.Entities;

namespace ClimbTracker.GUI.Utils
{
    public partial class HotSpot : UserControl
    {
        private String _innerText = "";
        private WallInstallation _wallInstallation = null;
        private int _y;

        public int Y
        {
            get { return _y; }
            set { _y = value; }
        }

        public String InnerText
        {
            get { return _innerText; }
            set { _innerText = value; }
        }
        public WallInstallation WallInstallation
        {
            get { return _wallInstallation; }
            set { _wallInstallation = value; }
        }

        

        public HotSpot()
        {
            InitializeComponent();
        }


        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ExStyle |= 0x00000020; //WS_EX_TRANSPARENT
                return cp;
            }
        }


        protected void InvalidateEx()
        {
            if (Parent == null)
                return;
            Rectangle rc = new Rectangle(this.Location, this.Size);
            Parent.Invalidate(rc, true);
        }



        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            //do not allow the background to be painted 
        }



        private GraphicsPath path = null;

        // Create the corresponding GraphicsPath for the shape, and apply
        // it to the control by setting the Region property.
        private void RefreshPath()
        {
            path = new GraphicsPath();
            path.AddRectangle(this.ClientRectangle);
            this.Region = new Region(path);
        }

        protected override void OnResize(System.EventArgs e)
        {
            base.OnResize(e);
            RefreshPath();
            this.Invalidate();
        }

        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);
            if (path != null)
            {
                e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                e.Graphics.FillPath(new SolidBrush(this.BackColor), path);
                e.Graphics.DrawPath(new Pen(this.ForeColor, 4), path);
                e.Graphics.DrawString(this.InnerText, new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold), new SolidBrush(this.ForeColor), 3, 3);
            }
        }


    }
}
